package top.jiangqiang.qianyi.common.properties;

import lombok.Data;
import org.dromara.hutool.core.collection.ListUtil;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import top.jiangqiang.qianyi.common.constants.GlobalConstants;
import top.jiangqiang.qianyi.common.constants.auth.Platform;

import java.util.List;
import java.util.Map;

import static top.jiangqiang.qianyi.common.constants.GlobalConstants.AdminRequestURLConstants.ADMIN_CONTROLLER_PATTERN;
import static top.jiangqiang.qianyi.common.constants.GlobalConstants.WebsiteRequestURLConstants.WEBSITE_CONTROLLER_PATTERN;

@Configuration
@ConfigurationProperties(prefix = GlobalConstants.GLOBAL_PREFIX + ".auth")
@Data
public class AuthProperties {
    /**
     * token有效时长，小于等于0则永不过期
     */
    private long duration = 60 * 60 * 1000;

    /**
     * header中token的名字
     */
    private String tokenKey = "Token";

    /**
     * 允许匿名访问的路径
     */
    private List<String> allowAnonymousAccess;

    /**
     * 允许模拟身份登录
     * 如果为true，请求头中可直接设置USER-ID和PLATFORM的值
     */
    private Boolean mock = (Boolean) false;
}
